PowerWEB LiveControls for ASP.NET
Manipulating Controls in a Callback
Send comments on this topic.



Glossary Item Box

PowerWEB LiveControls for ASP.NET has been engineered to not only manipulate LiveControls during a server callback, but also other non-LiveControls. Please note that this has not been tested with all 3rd party controls. Manipulating a non-LiveControl is done the same way as modifying a LiveControl, except that the Attribute "LiveControlUpdate" must be set to true on the non-LiveControl. When a LiveControl raises an event, the properties for a non-LiveControl can be set in that event. Below is the same example demonstrated in Using LiveControls but replaces the LiveLabel control with a standard Microsoft Label control (we recommend the use of LiveControls whenever possible as they provide extended events and the JavaScript used is more efficient).

The manipulation of Microsoft Web Controls from LiveControl callbacks has been fully tested, and no special steps (except use of the "LiveControlUpdate" attribute) are necessary. Many 3rd party controls, however, are more complex in nature. You should use LiveWrapper to wrap 3rd party controls so they can be updated from a callback. If your 3rd party control doesn't function with LiveWrapper, please contact our support department with your requirements.

  1. Follow the steps outlined in Using LiveControls so that a LiveButton and a Label are visible on the Designer as represented below.
  2. Add the "LiveControlUpdate = true" attribute to the Label server tag.
    <asp:Label id="Label1" LiveControlUpdate="true"></asp:Label>
    
  3. To add code using Code Behind double click the LiveButton to bring up the class representing the WebForm, then enter your code into the LiveButton1_Click event.

    The following code demonstrates setting Label1 to show the current time on the server when a button click occurs.

    [C#]
    Label1.Text = System.DateTime.Now.ToString(); 
    
    [Visual Basic]
    Label1.Text = System.DateTime.Now.ToString()
    
  4. Compile and run the Web application. You should now have a Web page in Internet Explorer that contains an image of a button. When pressing the button, the current system time should appear as shown below. You will notice that the screen did not refresh when the time appeared. Every time the button is clicked the current time will be displayed.

  5. Note! Non-visual controls such as Repeater do not have an Attributes collection, but these controls can still be updated from within a callback by placing the Repeater within a LivePlaceHolder control.
Documentation Version 4.0.2
© 2012 Dart Communications. All Rights Reserved.